package com.itheima.tlias84.service.impl;

import com.itheima.tlias84.entity.Stu;
import com.itheima.tlias84.mapper.StuMapper;
import com.itheima.tlias84.service.StuService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StuServiceImpl implements StuService {
    @Resource
    StuMapper stuMapper;


    @Override
    public int insertStu(Stu student) {
        return stuMapper.insertStu(student);
    }

    @Override
    public int deleteStuById(Integer id) {
        return stuMapper.deleteStuById(id);
    }

    @Override
    public int updateStuById(Stu student) {
        return stuMapper.updateStuById(student);
    }

    @Override
    public Stu selectStuById(Integer id) {
        if (stuMapper.selectStuById(id) != null) {
            return stuMapper.selectStuById(id);
        }
        return null;
    }

    @Override
    public List<Stu> selectAllStu() {
        return stuMapper.selectAllStudent();
    }

    @Override
    public int batchDelete(List<Integer> ids) {
        return stuMapper.batchDelete(ids);
    }

    @Override
    public int insertStuBatch(List<Stu> list) {
        return stuMapper.insertStuBatch(list);
    }
}
